{template 'common/header'}
{template 'common'}
<div class="main">
    <ul class="nav nav-tabs">
        <li{if $_GPC['do'] == 'manage' || $_GPC['do'] == '' } class="active"{/if}><a href="{php echo $this->createWebUrl('manage');}">微投票管理</a></li>
        <li{if $_GPC['do'] == 'post'} class="active"{/if}><a href="{php echo create_url('rule/post',array('module'=>'vote'));}">添加微投票规则</a></li>
    </ul>
    <div class="search">
        <form action="site.php" method="get">
            <input type="hidden" name="act" value="entry" />
            <input type="hidden" name="do" value="manage" />
            <input type="hidden" name="eid" value="{$_GPC['eid']}" />
            <table class="table table-bordered tb">
                <tbody>
                    <tr>
                        <th>关键字</th>
                        <td>
                            <input class="span6" name="keywords" id="" type="text" value="{$_GPC['keywords']}">
                        </td>
                    </tr>
                    <tr>
                    <tr class="search-submit">
                        <td colspan="2"><button class="btn btn-primary pull-left span2" style='margin-left:95px;'><i class="icon-search icon-large"></i> 搜索</button></td>
                    </tr>
                </tbody>
            </table>
        </form>
    </div>
    <div style="padding:15px;">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr><th class='with-checkbox'>
                        <input type="checkbox" class="check_all" /></th>
                    <th style="width:200px;">活动名称</th>

                    <th style="width:100px;">投票人数</th>
                    <th style="">总浏览数</th>
                    <th>投票限制</th>
                    <th>状态</th>
                    <th style="min-width:60px;">操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr>

                    <td class="with-checkbox">
                        <input type="checkbox" name="check" value="{$row['id']}"></td>	 
                    <td>{$row['title']} </td>
                    <td>{$row['votenum']}</td>
                    <td>{$row['viewnum']}</td>
                    <td>{$row['limits']}</td>
                    <td>{$row['status']}</td>
                    <td >
                        <a class="btn" rel="tooltip" href="{php echo create_url('rule/post', array( 'module' => 'vote','id'=>$row['id']))}" title="编辑"><i class="icon-edit"></i></a>
                        <a class="btn" href="{php echo create_url('site/module', array('do' => 'votelist', 'name' => 'vote', 'id' => $reply['rid']))}" title="投票名单"><i class="icon-list-alt"></i></a>
                        {if $row['show']==1}
                        <a class="btn" title="开始投票" href="#" onclick="drop_confirm('您确定要开始吗,设置中途可以随时修改!', '{php echo create_url('site/module', array('do' => 'status', 'name' => 'vote','rid'=>$row['id'],'status'=>1))}');"><i class="icon-play"></i></a>                                       
                        {elseif $row['show']==2}
                        <a class="btn" title="结束投票" href="#" onclick="drop_confirm('您确定要暂停吗,设置中途可以随时修改!', '{php echo create_url('site/module', array('do' => 'status', 'name' => 'vote','rid'=>$row['id'],'status'=>0))}');"><i class="icon-stop"></i></a>                                       														
                        {/if}

                        <a class="btn" rel="tooltip" href="#" onclick="drop_confirm('您确定要删除吗?', '{php echo create_url('site/module', array('do' => 'delete', 'name' => 'vote','rid'=>$row['id']))}');" title="删除"><i class="icon-remove"></i></a>
                    </td>
                </tr>
                {/loop}
                <tr>
                    <td colspan="7">

                        <input type="button" class="btn btn-primary" name="deleteall" value="删除选择的" />
                    </td>
                </tr>
            </tbody>
        </table>
        {$pager}
    </div>

</div>
<script>
            $(function(){

            $(".check_all").click(function(){
            var checked = $(this).get(0).checked;
                    $("input[type=checkbox]").attr("checked", checked);
            });
                    $("input[name=deleteall]").click(function(){

            var check = $("input:checked");
                    if (check.length < 1){
            err('请选择要删除的记录!');
                    return false;
            }
            if (confirm("确认要删除选择的记录?")){
            var id = new Array();
                    check.each(function(i){
                    id[i] = $(this).val();
                    });
                    $.post('{php echo create_url('site/module', array('do' => 'deleteAll', 'name' => 'vote'))}', {idArr:id}, function(data){
                    if (data.errno == 0)
                    {
                    location.reload();
                    } else {
                    alert(data.error);
                    }


                    }, 'json');
            }

            });
            });</script>
<script>
            function drop_confirm(msg, url){
            if (confirm(msg)){
            window.location = url;
            }
            }
</script>

{template 'common/footer'}